﻿#region

using System;

#endregion

namespace Jiubang.Communication.Common{
    public sealed class ByteConverter : AbstractConverter<byte>{
        public override byte[] Serialize(byte[] buffer, ref int offset, byte graph){
            buffer = EnsureBufferSize(buffer, offset + 1);
            buffer[offset] = graph;
            offset++;
            return buffer;
        }

        public override byte Deserialize(byte[] data, ref int offset){
            if (data == null) throw new ArgumentNullException("data");
            return data[offset++];
        }
    }
}